package service;

import model.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class CourseService {
    private CourseDao dao;
    @Autowired
    public void setCourseDao(CourseDao dao){
        this.dao=dao;
    }
    public boolean deleteCourse(String cno){
        return dao.deleteCourse(cno)>0;
    }
    public ArrayList<Course> getCourse(String cno){
        return dao.findCourseByCno(cno);
    }
    public ArrayList<Course> getAllCourses(){
        return dao.getAllCourses();
    }
    public boolean editCourse(Course course){
        return dao.editCourse(course)>0;
    }
    public boolean addCourse(Course course){
        return  dao.addCourse(course)>0;
    }
}
